package com.mx.recycle_demo

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.mx.recycle_demo.activity.AnyTypeActivity
import com.mx.recycle_demo.activity.AutoHeightRecycleViewActivity
import com.mx.recycle_demo.activity.BannerActivity
import com.mx.recycle_demo.activity.CoverFlowActivity
import com.mx.recycle_demo.adapt.HomeAdapt
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        val adapt = HomeAdapt(
            arrayListOf(
                HomePages("解决时RecycleView不显示的问题", AutoHeightRecycleViewActivity::class.java),
                HomePages("多类型RecycleView", AnyTypeActivity::class.java),
                HomePages("BannerView", BannerActivity::class.java),
                HomePages("中间放大，两边缩小，循环滑动", CoverFlowActivity::class.java)
            )
        )
        recycleView.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
        recycleView.adapter = adapt
        adapt.setItemClick { index, record ->
            startActivity(Intent(this, record.clazz))
        }
    }
}